package demo2;

class Outerclass {
    public int data1 = 1;
    public static int data2 = 2;
    private int data3 = 3;

    public void test(){
        Innerclass innerclass = new Innerclass();
        System.out.println("Outerclass::test()");
    }

    class Innerclass {
        public int data1 = 111;
        public int data4 = 4;
        public static final int data5 = 5;//编译的时候就确定
        private int data6 = 6;

        public void test(){
            System.out.println("Innerclass::test()");
            System.out.println(data1);
            System.out.println(Outerclass.this.data1);
            System.out.println(data2);
            System.out.println(data3);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
        }
    }
}
public class Test {
    public static void main(String[] args) {
        Outerclass outerclass = new Outerclass();
        Outerclass.Innerclass innerclass = outerclass.new Innerclass();
        innerclass.test();
        outerclass.test();
    }
}
